//
//  SIUtil.h
//  CampingLight
//
//  Created by Piccolo on 2017/11/5.
//  Copyright © 2017年 SmartIT. All rights reserved.
//

#import "DGActivityIndicatorView.h"
#import "SILightInfo.h"
#import "SIEnum.h"
#import "SIBleUtil.h"

@interface SIUtil : NSObject

+ (NSString *)getSingleKeyStr:(NSString *)str;
+ (NSString *)getDoubleKeyStr:(NSString *)str1 secondKey:(NSString *)str2;
+ (NSString *)getTripleKeyStr:(NSString *)str1 secondKey:(NSString *)str2 thirdKey:(NSString *)str3;
+ (NSString *)removeSpace:(NSString *)str;
+ (NSString *)platformString;
+ (BOOL)delegateExist:(id)delegate delegate:(Protocol *)protocol selector:(SEL)aSelector;
+ (UIBarButtonItem *)newBarItemWithImageName:(NSString *)imageName target:(UIViewController *)vc action:(SEL)action;
+ (NSString *)getDeviceVersion;
//+ (void)removeBtnTarget:(UIButton *)btn;
+ (void)setBtn:(UIButton *)btn imageName:(NSString *)imageName;
+ (void)setViewRoundCorner:(UIView *)view;
+ (void)addBtn:(UIButton *)btn target:(UIViewController *)target action:(SEL)action;
+ (void)setBtn:(UIButton *)btn imageName:(NSString *)imageName title:(NSString *)title target:(UIViewController *)target action:(SEL)action;
+ (void)setBtn:(UIButton *)btn imageName:(NSString *)imageName needRoundCorner:(BOOL)needRoundCorner target:(UIViewController *)target action:(SEL)action;
+ (void)setShadowToView:(UIView *)view;
+ (BOOL)checkPlatformIsFourType;
+ (BOOL)checkPlatformIsFiveType;
+ (BOOL)checkPlatformIsSixType;
+ (BOOL)checkPlatformIsSixPlusType;
+ (void)setCustomView:(UIView *)view transformMakeWidth:(CGFloat)width height:(CGFloat)height;
+ (void)resetView:(UIView *)view xValue:(CGFloat)xValue yValue:(CGFloat)yValue width:(CGFloat)width height:(CGFloat)height;
+ (void)resetView:(UIView *)view deltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY deltaWidth:(CGFloat)deltaWidth deltaHeight:(CGFloat)deltaHeight;
+ (void)setIndicator:(DGActivityIndicatorView *) indicator hidden:(BOOL)hidden target:(UIViewController *)target aboveSubView:(UIView *)view;
+ (DGActivityIndicatorView *)newIndicatorWithTarget:(UIViewController *)vc centerPoint:(CGPoint)point;
+ (BOOL)checkStringExist:(NSString *)str;
+ (BOOL)checkString:(NSString *)parentStr containSubString:(NSString *)subStr;
+ (BOOL)isExistDic:(NSDictionary *)dic key:(NSString *)key;

+ (void)setCampingLightInfo:(SILightInfo *)lightInfo
                       mode:(NSSILightMode)mode;

+ (void)setCampingLightInfo:(SILightInfo *)lightInfo smartTimeHour:(NSUInteger)smartTimeHour smartTimeMinute:(NSUInteger)smartTimeMinute;

+ (void)setCampingLightInfo:(SILightInfo *)lightInfo
            brightnessValue:(NSInteger)brightnessValue
             colorTempValue:(NSInteger)colorTempValue;

+ (NSDate *)awakenOnTimeFromCampingLightInfo:(SILightInfo *)lightInfo;
+ (NSDate *)awakenOffTimeFromCampingLightInfo:(SILightInfo *)lightInfo;


+ (void)setDownView:(UIView *)downView aboveView:(UIView *)upView spacing:(CGFloat)spacing;
+ (void)setRightView:(UIView *)rightView nextToView:(UIView *)leftView sameFrame:(BOOL)sameFrame spacing:(CGFloat)spacing;
+ (void)setBtn:(UIButton *)btn enabled:(BOOL)enabled;
+ (void)setBtn:(UIButton *)btn selected:(BOOL)selected;
+ (void)setUserDefaultObject:(NSObject *)obj forKey:(NSString *)key;
+ (id)userDefaultObjectForKey:(NSString *)key;

+ (void)setUserDefaultCampingLightInfo:(SILightInfo *)lightInfo toSceneType:(NSSISceneType)sceneType;
+ (BOOL)checkCampingLightInfo:(SILightInfo *)lightInfo isType:(NSSISceneType)sceneType;
+ (BOOL)sceneExist:(NSSISceneType)sceneType;
+ (SILightInfo *)lightInfoFromSceneType:(NSSISceneType)sceneType currentLightInfo:(SILightInfo *)currentLightInfo;
+ (NSString *)convertDateToString:(NSDate *)date withFormatter:(NSString *)formatterStr;
+ (NSDate *)convertStringToDate:(NSString *)dateStr withFormatter:(NSString *)formatterStr;
+ (NSDate *)dateFromHour:(NSUInteger)hour minute:(NSUInteger)minute;
+ (NSInteger)hourFromTime:(NSDate *)date;
+ (NSInteger)minuteFromTime:(NSDate *)date;
+ (NSDate *)getDateAfterDay:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second;
+ (NSDate *)getDateAfterDate:(NSDate *)date day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second;
+ (NSInteger)minutesBetween:(NSDate *)firstDate and:(NSDate *)secondDate;
+ (NSInteger)getPositiveTimeMin:(NSInteger)timeMin;
+ (void)setHistoryPeripheralNameToUserDefault:(NSString *)peripheralName;
+ (NSDate *)getFiveTimesDateFromDate:(NSDate *)date;
+ (void)addBottomBorderToTextField:(UITextField *)textField leftViewText:(NSString *)leftViewText;
+ (NSString *)decimalToBinary:(uint16_t)tmpid backLength:(int)length;
+ (NSString *)stringOfEndIndex:(NSInteger)index totalString:(NSString *)totalString;
+ (BOOL)isAtMainThread;
+ (NSString *)identityVersion;
+ (void)resetAllDefaults;
+ (void)setSuperView:(UIView *)superView fromLastSubView:(UIView *)lastSubView spacing:(CGFloat)spacing;
@end
